package dailytest;

import cn.hutool.core.util.NumberUtil;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @author: heweiwei
 * @Date: 2022/8/15 20:43
 * @Desc:
 */
public class BigDecimalTest {
    public static void main(String[] args) {

        BigDecimal multiply = (BigDecimal.valueOf(3)
                .multiply(new BigDecimal(String.valueOf(6))))
                .divide(BigDecimal.valueOf(18), 2, RoundingMode.HALF_UP);
        System.out.println("multiply = " + multiply);


        System.out.println(new BigDecimal("721.0546").setScale(2, RoundingMode.UP).toPlainString());
        System.out.println(new BigDecimal("721.0546").setScale(2, RoundingMode.HALF_UP).toPlainString());


        System.out.println(NumberUtil.add(NumberUtil.mul(new BigDecimal("23"), new BigDecimal("31.35")),
                BigDecimal.ZERO).toPlainString());


        System.out.println(NumberUtil.add(NumberUtil.mul(new BigDecimal("23"), new BigDecimal("31.35")),
                NumberUtil.mul(BigDecimal.valueOf(0), new BigDecimal("2.23928571"))).toPlainString());


        System.out.println(2/2);

    }
}
